home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_5 / issue_09 / power / StylesDoc < prev   
Encoding:
Text File  |  1992-05-29  |  5.2 KB  |  117 lines

  1.  
  2. STYLES: A simple application of Pattern Programming using REPLACE 1.00
  3.  
  4. Replace 1.00: Copyright (C) 1991 Michael Houlder
  5.  
  6.  
  7. 1. Purpose
  8. ==========
  9. STYLES is a simple filter application which "extends the DDE" in the sense described by
  10. Acorn's documentation for the Desktop Development Environment.
  11.  
  12. The DDE environment for the application allows the filter to multi-task with any other
  13. desktop application, in particular IMPRESSION.
  14.  
  15. It is of use sometimes to list all the Impression styles that have been actually used for
  16. one particular "text story"; i.e. distinct from just those that are defined for the
  17. document. Impression lists these latter perfectly adequately.
  18.  
  19. Having selected a particular text story in Impression, if the "Save text story" dialogue
  20. 'save' icon is dragged to the iconbar !Styles icon, then a list of the styles used will
  21. be displayed. This assumes that the default choice of "With Styles" has not been changed.
  22.              
  23. Rather than use the relatively lengthy "Save Text Story" dialogue, the direct CONTROL-SHIFT-T
  24. keystroke makes the 'save' icon available immediately for dragging to !Styles.
  25.  
  26. Alternatively, the text story 'save' icon may be dragged to a filer directory window where
  27. it causes the creation of a permanent file. The corresponding filer icon may be dragged in
  28. turn to !Styles to create the style listing.
  29.  
  30.  
  31. 2. References
  32. =============
  33. (a) The DDE format !help files contained in the two applications associated with this
  34. documentation: !Replace and !Styles.
  35.  
  36. (b) The 3 parts of my article "Power Search: A Quiet AI Revolution" contained in Archive
  37. magazine, Vols 5.7, 5.8, 5.9 for April, May and June respectively. 
  38.  
  39. (c) The Acorn User Guide for the DDE.
  40.  
  41. (d) Computer Concept's user guide for Impression 2.
  42.  
  43.  
  44. 3. Impression DDF
  45. =================
  46. Impression supports an alternative ASCII text format for its document data files. This is the
  47. Document Description Format (DDF). Graphics are not included, of course. The document text is
  48. held as ordinary text.
  49.  
  50. The additional format and display applications and definitions are held in the form of an
  51. ASCII text language. Sentences from this language are embedded within the document text.
  52. The document text plus the embedded format & display language together make up the DDF.
  53.  
  54. The grammar plus examples for the format & display definition language are given in the
  55. user guide for Impression 2, pp.254.
  56.  
  57.  
  58. 4. Operation
  59. ============
  60. In particular, examples of style application sentences are given: e.g. {"Bold" on}. In this
  61. example, from this point on in the document text until cancelled by {"Bold" off}, the document
  62. text will be displayed in the Bold style.
  63.  
  64. By definition, the symbol '{' always introduces sentences from the display & definition
  65. language. Any occurrences within the document text are suppressed.
  66.  
  67. Hence, any application or cancellation of any style is the symbol '{' followed by a quoted
  68. string. If all these instances are found by pattern matching, then all styles used have been
  69. identified.
  70.  
  71. If everything else in the text story is deleted, then the list left behind includes all
  72. styles used.
  73.  
  74. However, the list also includes unwanted duplications. Another filter supplied as part of the DDE,
  75. COMMON, has the ability to list just one copy of each word in a text file. If COMMON is applied
  76. to the partially text story, then COMMON will produce a list of styles; each style listed just once.
  77.  
  78. If REPLACE is used once more to delete unwanted statistics etc from the COMMON output, then the
  79. desired result is achieved
  80.  
  81.  
  82. 5. Limitations of COMMON
  83. ========================
  84. COMMON suffers from one limitation which causes problems in this application. The characters
  85. that COMMON uses to identify the ends of words are not user-definable. Any character that is not
  86. alphanumeric is defined to separate words
  87.  
  88. For our application, we need a much reduced range of separators: just newline (linefeed).
  89. Impression allows style names such as "Main Heading" and "Sub-heading". COMMON thinks these two
  90. strings represent 4 words, and hence we have 4 separate styles.
  91.  
  92. The solution, short of writing a new version of COMMON, is to insert, using REPLACE, unused
  93. character combinations in place of these non-alphanumeric characters which can in turn be replaced
  94. when COMMON has done its work.
  95.  
  96.  
  97. 6. Application Structure
  98. ========================
  99. The DDE interface, !Styles calls an Obey file, "ObeyFile". This has five commands:
  100.  
  101.         Call 1 to REPLACE : using pattern program "prog11", this deletes everything in the supplied
  102.                 text story except the names from style applications and cancelations. It also
  103.                 replaces within these names any character COMMON will think of as a word
  104.                 separator.
  105.  
  106.         Call to COMMON : this produces a list of style names with duplicates suppressed, together
  107.                 with some unwanted statistics.
  108.  
  109.         Call 2 to REPLACE : using pattern program "prog22", this deletes the unwanted
  110.                 statistics. It also replaces the non-alphanumeric characters that are part of
  111.                 the style names found.
  112.  
  113.         Type : this displays the style name list with the output appearing in the DDE display
  114.                 window.
  115.  
  116.         Wipe : this deletes the working files which are no longer needed.
  117.